/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.risk.card.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.common.core.util.StringUtils;
import com.hopes.bizz.risk.card.entity.RiskCardNotifyEntity;
import com.hopes.bizz.risk.control.entity.RiskObjectEntity;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * 有害因素应知卡
 *
 * @author cx
 * @date 2023-08-03 16:01:08
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "有害因素应知卡DTO")
public class RiskCardNotifyEntityDTO extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


	public RiskCardNotifyEntity toPO() {
		RiskCardNotifyEntity entity = new RiskCardNotifyEntity();
		BeanUtils.copyProperties(this, entity);

		if (StringUtils.isNotBlank(this.forbidSignList)) {
			StringBuilder builder = new StringBuilder();
			for (String id : this.forbidSignList) {
				builder.append(id).append(",");
			}
			builder.deleteCharAt(builder.length() - 1);
			entity.setForbidSign(builder.toString());
		}

		if (StringUtils.isNotBlank(this.alarmSignList)) {
			StringBuilder builder = new StringBuilder();
			for (String id : this.alarmSignList) {
				builder.append(id).append(",");
			}
			builder.deleteCharAt(builder.length() - 1);
			entity.setAlarmSign(builder.toString());
		}

		if (StringUtils.isNotBlank(this.cmdSignList)) {
			StringBuilder builder = new StringBuilder();
			for (String id : this.cmdSignList) {
				builder.append(id).append(",");
			}
			builder.deleteCharAt(builder.length() - 1);
			entity.setCmdSign(builder.toString());
		}

		return entity;
	}
	/**
	* 标识
	*/

    private Long id;

	/**
	* 编号
	*/

    private String cardNo;

	/**
	* 名称
	*/

    private String cardName;

	/**
	* 风险等级
	*/

    private Integer riskLevel;

	/**
	* 主要危险有害因素
	*/

    private String mainDesc;

	/**
	* 易导致的事故风险
	*/

    private String accidentDesc;

	/**
	* 风险管控措施
	*/
    private String controlDesc;

	/**
	* 应急处置对策
	*/
    private String handleDesc;

	/**
	* 安全操作规程
	*/
    private String safeOperationDesc;

	/**
	* 禁止
	*/
    private String forbidSign;

	/**
	* 警告
	*/
    private String alarmSign;

	/**
	* 指令
	*/
    private String cmdSign;

	/**
	* 文件图片
	*/
    private String file;

	/**
	* 类型
	*/
    private Integer type;

	/**
	* 责任人
	*/
    private String kahuna;

	/**
	* 责任人电话
	*/
    private String kahunaPhone;

	/**
	* 应急值班室电话
	*/
    private String emergencyTelephone;

	/**
	* 机构ID
	*/
    private Long orgId;

	private List<String> forbidSignList;

	private List<String> alarmSignList;

	private List<String> cmdSignList;


}